import { useState } from "react";
import { Switch, Divider, Flex } from "antd";
const View = () => {
    const [checked, setChecked] = useState(true);
    const onChange = (checked) => {
        console.log(`switch to ${checked}`);
        setChecked(checked);
    };
    return (
        <>
            <h1>Switch开关</h1>
            <Flex gap={20}>
                <Switch value={checked} onChange={onChange} />
                <Switch
                    value={checked}
                    onChange={onChange}
                    checkedChildren='开启'
                    unCheckedChildren='关闭'
                />
                <Switch value={checked} onChange={onChange} loading />
            </Flex>
        </>
    );
};

export default View;
